<script setup>
import { ShoppingCart, Monitor, DataAnalysis, Setting } from '@element-plus/icons-vue'
import { useRouter } from 'vue-router'

const router = useRouter()

const goToLogin = () => {
  router.push('/login')
}
</script>

<template>
  <div class="home">
    <div class="welcome-section">
      <h1>收银管理系统</h1>
      <p class="subtitle">POS System - 现代化的收银解决方案</p>
    </div>

    <div class="features-grid">
      <div class="feature-card">
        <el-icon class="feature-icon" size="48">
          <ShoppingCart />
        </el-icon>
        <h3>登录系统</h3>
        <p>安全可靠的用户认证系统，支持验证码验证和记住密码功能</p>
        <el-button type="primary" @click="goToLogin">体验登录</el-button>
      </div>

      <div class="feature-card">
        <el-icon class="feature-icon" size="48">
          <Monitor />
        </el-icon>
        <h3>收银管理</h3>
        <p>完整的收银流程管理，包括商品录入、价格计算、支付处理</p>
        <el-button type="success" disabled>即将推出</el-button>
      </div>

      <div class="feature-card">
        <el-icon class="feature-icon" size="48">
          <DataAnalysis />
        </el-icon>
        <h3>数据分析</h3>
        <p>实时销售数据统计，营业额分析，商品销售趋势</p>
        <el-button type="warning" disabled>即将推出</el-button>
      </div>

      <div class="feature-card">
        <el-icon class="feature-icon" size="48">
          <Setting />
        </el-icon>
        <h3>系统设置</h3>
        <p>灵活的系统配置，支持多门店管理，权限控制</p>
        <el-button type="info" disabled>即将推出</el-button>
      </div>
    </div>

    <div class="login-demo">
      <h2>登录页面演示</h2>
      <div class="demo-info">
        <p><strong>测试账号：</strong></p>
        <ul>
          <li>用户名：<code>admin</code></li>
          <li>密码：<code>123456</code></li>
        </ul>
        <p><strong>功能特性：</strong></p>
        <ul>
          <li>✅ 用户名密码验证</li>
          <li>✅ 图形验证码验证</li>
          <li>✅ 记住密码功能</li>
          <li>✅ 响应式设计</li>
          <li>✅ 现代化UI设计</li>
        </ul>
      </div>
      <el-button type="primary" size="large" @click="goToLogin">
        立即体验登录页面
      </el-button>
    </div>
  </div>
</template>

<style scoped>
.home {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

.welcome-section {
  text-align: center;
  margin-bottom: 60px;
}

.welcome-section h1 {
  font-size: 48px;
  font-weight: 700;
  background: linear-gradient(135deg, #409eff, #67c23a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}

.subtitle {
  font-size: 20px;
  color: #606266;
  margin: 0;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  margin-bottom: 60px;
}

.feature-card {
  background: white;
  border-radius: 16px;
  padding: 30px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: 1px solid #f0f0f0;
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
}

.feature-icon {
  color: #409eff;
  margin-bottom: 20px;
}

.feature-card h3 {
  font-size: 24px;
  font-weight: 600;
  color: #303133;
  margin: 0 0 16px 0;
}

.feature-card p {
  color: #606266;
  line-height: 1.6;
  margin-bottom: 24px;
}

.login-demo {
  background: linear-gradient(135deg, #f5f7fa, #c3cfe2);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  margin-top: 40px;
}

.login-demo h2 {
  font-size: 32px;
  font-weight: 600;
  color: #303133;
  margin-bottom: 30px;
}

.demo-info {
  background: white;
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 30px;
  text-align: left;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.demo-info p {
  margin: 0 0 16px 0;
  font-size: 16px;
}

.demo-info ul {
  margin: 0 0 20px 0;
  padding-left: 20px;
}

.demo-info li {
  margin-bottom: 8px;
  color: #606266;
}

.demo-info code {
  background: #f5f7fa;
  padding: 4px 8px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  color: #409eff;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .welcome-section h1 {
    font-size: 36px;
  }

  .subtitle {
    font-size: 18px;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .feature-card {
    padding: 20px;
  }

  .login-demo {
    padding: 30px 20px;
  }

  .login-demo h2 {
    font-size: 28px;
  }
}
</style>
